{{include file='admin/include/inside_header.php'}}
<body>
<div class="container-fluid">
      <div class="row">
        <div class="col-md-12">
			<!--main/S-->
			 <div class="weichat_panel">
			   <div class="wchat_form">
				<form class="form-horizontal" id="add_form" method="post" role="form">
					{{if $bean!=null }}
        				<input type="hidden" id="id" name="id" value="{{$bean.id}}"/>	
					{{/if}}
<div class="form-group">
                                    <label for="id" class="col-sm-2 control-label">ID</label>
                                    <div class="col-sm-5">
                                      <input type="text" class="form-control" value="{{$bean.id}}" name="id" id="id" placeholder="请输入ID">
                                    </div>
                                  </div><div class="form-group">
                                    <label for="parent_id" class="col-sm-2 control-label">父节点</label>
                                    <div class="col-sm-5">
                                      <input type="text" class="form-control" value="{{$bean.parent_id}}" name="parent_id" id="parent_id" placeholder="请输入父节点">
                                    </div>
                                  </div><div class="form-group">
                                    <label for="region_name" class="col-sm-2 control-label">名称</label>
                                    <div class="col-sm-5">
                                      <input type="text" class="form-control" value="{{$bean.region_name}}" name="region_name" id="region_name" placeholder="请输入名称">
                                    </div>
                                  </div><div class="form-group">
                                    <label for="region_type" class="col-sm-2 control-label">类型</label>
                                    <div class="col-sm-5">
                                      <input type="text" class="form-control" value="{{$bean.region_type}}" name="region_type" id="region_type" placeholder="请输入类型">
                                    </div>
                                  </div><div class="form-group">
                                    <label for="agency_id" class="col-sm-2 control-label">代理ID</label>
                                    <div class="col-sm-5">
                                      <input type="text" class="form-control" value="{{$bean.agency_id}}" name="agency_id" id="agency_id" placeholder="请输入代理ID">
                                    </div>
                                  </div><!-- End SmartWizard Content -->  
				<div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <button id="submit_btn" type="submit" class="btn btn-default">提交</button>
                    </div>
                  </div>
				  
                </form>
               </div>
            </div>
			<!--main/E-->
		</div>
      </div>
</div>
<!-- Footer================================================== -->
{{include file='admin/include/footer.php'}}
 <script type="text/javascript">
     $(function(){
		//提交表单
       	  $('#add_form').validator({
        		theme: 'yellow_right_effect',  //设置theme
        		stopOnError: true, //
        		showOk:false,
        	    fields: {
        	        "name": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写角色名称",
        	            msg: {
        	            	required: "名称不可以为空!",
        	            }
        	        }
        	    }
        	});
		  $('#add_form').on('valid.form', function(e, form){
		  	   //成功之后刷新gd，关闭自己
			   var data=$(this).serialize();
			    var this_obj=$('#submit_btn');
				//提交表单
				this_obj.addClass('disabled');
				this_obj.html('提交中...');
               $ .axsf('admin/region/add',data,function(d){
			   		if(d){
                         if(d.code==200){
							window.location.href="admin/region/index";
                         }else{
						 	alert(d.message);
						 }
                	}
					 this_obj.removeClass("disabled");
             		 this_obj.html('保存');
			   });
        });
});
    </script>
    </body>
    </html>